{% extends "base.jinja" %}

{% block keywords %}{{site_options.keyword}}{% endblock %}
{% block description %}{{site_options.description}}{% endblock %}

{% block css %},main.css{% endblock %}

{% block pagetype %}home{% endblock %}

{% block main %}
    <div class="layout h-promote">
        <div class="hp-cycle" id="hp-cycle">
            <ul>
                {% for data in promote_data.get('home_cycle') %}
                <li {% if loop.index == 1 %}class="hp-active"{% endif %}>
                    <div class="hpc-img">
                    {% if data.path.find('http')> -1%}{% set path = data.path %}{% else %}{% set path = 'http://s.lovewith.me/static/upload/%s' % data.path %}{% endif %}
                    {% if loop.index == 1 %}
                        <a href="{{data.link}}" target="_blank"><img alt="{{data.title|safe}}" data-hasload="1" src="{{path}}" width="600" height="410" /></a>
                    {% else %}
                        <a href="{{data.link}}" target="_blank"><img alt="{{data.title|safe}}" src="http://s.lovewith.me/static/images/blank.gif" data-src="{{path}}" width="600" height="410" /></a>
                    {% endif %}
                    </div>
                    <div class="hpc-ext">
                        <b><a href="{{data.link}}" target="_blank">{{data.title|safe}}</a></b>
                        <p><a href="{{data.link}}" target="_blank">{{data.desc|safe}}</a></p>
                    </div>
                </li>
                {% endfor %}
            </ul>
        </div>
        <ul class="hp-nav" id="hp-nav" data-imgcount="{{image_count}}">
        </ul>
        <ul class="hp-ad" id="hp-ad">
            {% for data in promote_data.get('home_ad') %}
            <li>
                {% if data.path.find('http')> -1%}{% set path = data.path %}{% else %}{% set path = 'http://s.lovewith.me/static/upload/%s' % data.path %}{% endif %}
                <a target="_blank" href="{{data.link}}"><img width="280" height="70" src="http://s.lovewith.me/static/images/blank.gif"  data-src="{{path}}" /></a>
            </li>
            {% endfor %}
        </ul>
    </div>

    <div class="h-main" id="h-main">
        <div class="layout h-share" id="h-share">
            <div class="hs-title">精选DALIY</div>
            <div class="share hs-bd" id="share" data-wf="none">
            {% for g in share_data %}
                <ul>
                    {% for share in g.share %}
                    <li data-mid="{{share.cover_id}}" class="hs-item-{{loop.index}}">
                        <a target="_blank" class="s-link" href="{{domain}}share/detail/all/{{share.share_id}}/" {%if share.background%}style="background:{{share.background}};opacity:0.5;"{%endif%}>
                        {% if loop.index == 3 %}
                            <img alt="{{share.title}}" src="http://s.lovewith.me/static/images/blank.gif" data-src="{{share.cover}}!600x260" width="600" height="260" />
                        {% elif loop.index == 4 %}
                            <img alt="{{share.title}}" src="http://s.lovewith.me/static/images/blank.gif" data-src="{{share.cover}}!260x550" width="260" height="550" />
                        {% elif loop.index == 7 %}
                            <img alt="{{share.title}}" src="http://s.lovewith.me/static/images/blank.gif" data-src="{{share.cover}}!600x550" width="600" height="550" />
                        {% else %}
                            <img alt="{{share.title}}" src="http://s.lovewith.me/static/images/blank.gif" data-src="{{share.cover}}!260x260" width="260" height="260" />
                        {% endif %}
                        </a>
                        {% if share.is_video %}
                            <span class="ui ed-video" data-video="{{share.video}}"></span>
                        {% endif %}
                        <div class="s-ext">
                            <p title="{{share.title|forceescape}}">
                                {% if loop.index == 3 or loop.index == 7 %}
                                    <a target="_blank" href="{{domain}}share/detail/all/{{share.share_id}}/">{{share.title|safe|cut_str(25)}}</a>
                                {% else %}  
                                    <a target="_blank" href="{{domain}}share/detail/all/{{share.share_id}}/">{{share.title|safe|cut_str(16)}}</a>
                                {% endif %}
                            </p>
                        </div>
                        <p class="s-desc">{{share.content|safe|cut_str(120)}}</p>
                        {% if share.reserve %}
                        <a target="_blank" href="{{domain}}share/detail/all/{{share.share_id}}/#m{{share.cover_id}}" class="ui s-reserve"></a>
                        {% else %}
                            {% if share.sale_data %}
                            <a target="_blank" href="{{domain}}share/detail/all/{{share.share_id}}/#m{{share.cover_id}}" class="ui s-sale"></a>
                            {% endif %}
                        {% endif %}
                    </li>
                    {% endfor %}
                </ul>
            {% endfor %}
            </div>
        </div>

        <div class="layout h-column" id="h-column">
            <div class="hc-title">栏目</div>
            <div class="hc-bd">
                <ul>
                    {% set n = 1 %}
                    {% for column in column_data%}
                    <li {% if n == 1 or n ==4 %}class="hc-item-w"{% endif %}>
                        <h3>{{column.title}}</h3>
                        {% autoescape off %}{{column.content}}{% endautoescape %}
                    </li>
                    {% if n>=4 %}
                        {% set n = 1 %}
                    {% else %}
                        {% set n = n + 1 %}
                    {% endif %}
                    {% endfor %}
                </ul>
            </div>
        </div>

        <div class="layout h-album" id="h-album">
            <div class="ha-title">
                <h5>婚礼灵感板</h5><span>新娘们已经整理了<em>{{album_count}}</em>个灵感板为自己参考</span>
                <a class="inp-btn-pk-m" target="_blank" href="{% if not user.is_authenticated() %}#{%else%}{{domain}}u/{{user.id}}/album/all{%endif%}/" data-require="sign">我的灵感板</a>
            </div>
            <div class="ha-bd">
                <ul>
                    {% for a in album %}
                    <li>
                        {% if a.attach[0] %}
                        <a title="{{a.attach[0].title}}" target="_blank" class="hma-top" href="{{domain}}u/{{a.user_id}}/album/{{a.album_id}}/">
                            <img alt="{{a.name}}" src="http://s.lovewith.me/static/images/blank.gif" data-src="{{a.attach[0].path}}!260" />
                            <p>{{a.attach[0].description|safe|cut_str(120)}}</p>
                        </a>
                        {% else %}
                            <span class="hma-top"></span>
                        {% endif %}

                        {% if a.attach[1] %}
                        <a title="{{a.attach[1].title}}" target="_blank" class="hma-left" href="{{domain}}u/{{a.user_id}}/album/{{a.album_id}}/">
                            <img alt="{{a.name}}" src="http://s.lovewith.me/static/images/blank.gif" data-src="{{a.attach[1].path}}!260" />
                            <p>{{a.attach[0].description|safe|cut_str(120)}}</p>
                        </a>
                        {% else %}
                            <span class="hma-left"></span>
                        {% endif %}

                        {% if a.attach[1] %}
                        <a title="{{a.attach[2].title}}" target="_blank" class="hma-right" href="{{domain}}u/{{a.user_id}}/album/{{a.album_id}}/">
                            <img alt="{{a.name}}" src="http://s.lovewith.me/static/images/blank.gif" data-src="{{a.attach[2].path}}!260" />
                            <p>{{a.attach[0].description|safe|cut_str(120)}}</p>
                        </a>
                        {% else %}
                            <span class="hma-right"></span>
                        {% endif %}

                        <div class="hma-data">
                            <a target="_blank" href="{{domain}}u/{{a.user_id}}/album/{{a.album_id}}/"><img class="avatar" alt="{{a.user_name}}" src="http://s.lovewith.me/static/images/blank.gif" data-src="{{a.user_avatar}}!50" width="25" /></a>
                            <p><a target="_blank" href="{{domain}}u/{{a.user_id}}/album/{{a.album_id}}/">{{a.name}}</a></p>
                        </div>
                    </li>
                    {% endfor %}
                </ul>
            </div>
        </div>
    </div>
    <input type="hidden" id="ug-content" value="0@body@50%@0|1@st-cate@-53@38|2@st-color@-53@38|3@user-guide-search@-78@31|4@user-guide-user@-80@55|5@user-guide-code@-297@-150|6@user-guid-nav@-297@53" />
{% endblock %}

{% block script %}
<script>seajs.use('page/home', function(p){p.render()});</script>
{% endblock %}